
/**
 * primitive Label 大量加载
 * 
 */
 import Primitive from "../Primitive"

 const DEFAULT_STYLE = {
   fillColor: Cesium.Color.SKYBLUE, // default: WHITE
   show: true,
   font : '16px sans-serif',
   scaleByDistance: new Cesium.NearFarScalar(1.5e7, 1.0, 1.5e7, 0.5),
   eyeOffset: new Cesium.Cartesian3(0.0, 100.0, 0.0),
   distanceDisplayCondition : new Cesium.DistanceDisplayCondition( 10. ,5000000.0)
 }
 
 export default class LabelPrimitive extends Primitive {
   /**
    * 
    * @param {*} positions 
    * @param {*} text 
    * @param {*} options 
    */
   constructor(positions, text , options = {}) {
     super()
     this._positions = positions
     this._text = text
     this._type = 'label_primitive'
     this._style = {
       ...DEFAULT_STYLE,
       ...options
     }
     this.delegate = {}
     this.mounted()
   }
 
   /**
    * 属性初始化
    */
   mounted() {
     this.positions = this._positions
     this.text = this._text
     this.style = this._style
   }
 
   /**
    * 
    * @param {*} style 
    * @returns 
    */
 
   setStyle(style) {
     if (!style) return
     Object.assign(this._style, { ...style })
     Object.assign(this.delegate, {
       ...this._style
     })
   }
 
   get positions() {
     return this._positions
   }
 
   set positions(val) {
     this._positions = val
     this.delegate.position = this._positions
   }

   get text (){
     return this._text
   }

   set text(val){
     this._text = val
     this.delegate.text = this._text
   }
 }
 